
Titanium.UI.setBackgroundColor('#000');


Ti.Gesture.isLandscape = function (orient) {
  orient = orient || Ti.UI.orientation;
  return orient == Ti.UI.LANDSCAPE_LEFT || orient == Ti.UI.LANDSCAPE_RIGHT;
};
 
Ti.Gesture.isPortrait = function (orient) {
  orient = orient || Ti.UI.orientation;
  return orient == Ti.UI.PORTRAIT || orient == Ti.UI.UPSIDE_PORTRAIT;
};

var tabGroup = Titanium.UI.createTabGroup();

var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({  
    icon:'KS_nav_views.png',
    title:'Test orientation',
    window:win1
});

var label = Titanium.UI.createLabel({
	color: '#000',
    text: 'Orientation',
    top: 75,
    left: 30,
    width: 150,
    height: 'auto'
})

win1.add(label);

Ti.Gesture.addEventListener('orientationchange', function (ev) {
  if (Ti.Gesture.isLandscape(ev.orientation)) {
    label.text = "Paysage";
  } else {
    label.text = "Portrait";
  }
});

tabGroup.addTab(tab1);  
tabGroup.open();

win1.orientationModes = [
        Titanium.UI.LANDSCAPE_LEFT,
        Titanium.UI.LANDSCAPE_RIGHT
    ];
